﻿using System;
using Sucdri.Infrastructure.Core.Properties;

namespace Sucdri.Infrastructure.Core
{
   public static class Guard
   {
      public static void ArgumentNotNullOrEmpty(string argumentName,string argumentValue=null)
      {
         if(argumentValue==null)
            throw new ArgumentNullException(argumentName);
         if(string.IsNullOrWhiteSpace(argumentValue))
            throw new ArgumentException(Resource.StringArgMustNotBeEmpty,argumentName);
      }

      public static void ArgumentNotNull(string argumentName, object argumentValue = null)
      {
         if (argumentValue == null)
            throw new ArgumentNullException(argumentName);
      }

      public static void VariableNotNull(string variableName,object variableValue)
      {
         if (variableValue == null)
            throw new InvalidOperationException(string.Format(Resource.VariableMustNotBeNull,variableName));
      }
   }
}
